<template>
  <div id="app">
    <editor
      api-key="q0067g07wq9mo8ykgah7cngwkffdyi4elqnxkw9ztz0wq6jr"
      :init="{
        height: 800,
        language: 'zh_CN',
        menubar: false,
        plugins: [
          'advlist autolink lists link image charmap print preview anchor',
          'searchreplace visualblocks code fullscreen',
          'insertdatetime media table paste code help wordcount'
        ],
        toolbar: [
          'undo redo | cut copy paste pastetext | selectall | codesample code | searchreplace visualblocks fullscreen preview print',
          'bold italic underline strikethrough subscript superscript | forecolor backcolor | removeformat',
          'fontselect fontsizeselect formatselect', 'alignleft aligncenter alignright alignjustify | outdent indent | bullist numlist | checklist',
          'link unlink anchor image media ',
          'table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol'
        ],
        fontsize_formats: '8px 10px 12px 14px 16px 18px 24px 36px',
        content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
      }"
      v-model="content"
    />
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancelAction('ruleForm')">取 消</el-button>
      <el-button :loading="loading" type="primary" @click="addAction">确 定</el-button>
    </div>
  </div>
</template>

<script>
import Editor from '@tinymce/tinymce-vue';

export default {
  name: 'App',
  components: {
    Editor
  },
  data() {
    return {
      content: '',
      loading:false
    };
  },
  methods: {
    addAction() {
      console.log(this.content)
    }
  }
};
</script>

<style lang="scss" scoped>
.editor-container {
  display: flex;
  height: calc(100vh - 200px);
  gap: 20px;
}

.editor-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  overflow: hidden;
}

.preview-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  overflow: hidden;
}

.editor-header,
.preview-header {
  padding: 10px;
  background-color: #f5f7fa;
  border-bottom: 1px solid #dcdfe6;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-content,
.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.preview-content {
  background-color: #fff;
}

.variable-text {
  color: #409EFF;
  cursor: pointer;
  text-decoration: underline;
}

.variable-text:hover {
  color: #66b1ff;
}
</style>
